<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%
    String path=request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!--     <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
 -->    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">进度审核</a>
        <a>
          <cite>审核进度</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <script type="text/javascript">
   
    </script>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" >
        	<input type="hidden" id="pageNo">
          <input type="text" name="centerforadvancedPersonnelName" id="xiaoyao2"  placeholder="请输入保单人姓名" autocomplete="off" class="layui-input">
          <button type="button" class="layui-btn"   id="xiaoyao" ><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
     <xblock>
     
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th> 
            <th>编号</th>
            <th>保单人姓名</th>            
            <th>查勘人姓名</th>
            <th>事故地点</th>
            <th>事故车牌</th>
          	<th>垫付金额</th>
            <th>垫付通知书</th>
            <th>录入时间</th>
            <th>审核状态</th>
           
          </tr>
        </thead>
        <tbody>
       
       
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>centerforadvancedId1</td>
            <td>centerforadvancedPolicyHolderName2</td>
            <td>centerforadvancedPersonnelName3</td>
            <td>centerforadvancedDangerAddress4</td>
            <td>centerforadvancedCarNo5</td>
            <td>centerforadvancedAdvancePrices6</td>
            <td>centerforadvancedCarKey7</td>
            <td>centerforadvancedTime8</td>
            <td class="td-status">
            	
              <span class="layui-btn layui-btn-normal layui-btn-mini">申请中</span>
              </td>
            
          </tr>
       
        </tbody>
      </table>
      <div class="page">
        <div>
          <a class="num1">首页</a>
          <a class="num2" href="">上一页</a>
          <a class="num3" href="">下一页</a>
          <a class="num4" href="">尾页</a>
        
        </div>
        
      </div>
    </div>
    <script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">

    	function add0(m){return m<10?'0'+m:m }
    	//时间戳转化成时间格式
    	function timeFormat(timestamp){
    	  //timestamp是整数，否则要parseInt转换,不会出现少个0的情况
    	    var time = new Date(timestamp);
    	    var year = time.getFullYear();
    	    var month = time.getMonth()+1;
    	    var date = time.getDate();
    	    var hours = time.getHours();
    	    var minutes = time.getMinutes();
    	    var seconds = time.getSeconds();
    	    return year+'-'+add0(month)+'-'+add0(date)+' '+add0(hours)+':'+add0(minutes)+':'+add0(seconds);
    	}
    $(document).ready(function(){
    
    	inti(null,1);
    	$("#xiaoyao").click(function(){
    		var xxx=$("#xiaoyao2").val();
    		inti(xxx,1);
    	})
    });
    function zhuangtai(data,ID,prices){
 		var centerforadvancedPersonnelName = $("#xiaoyao2").val();
 		var pageNo = $("#pageNo").val();
    	$.ajax({
    		"url":"Advanced5.do",
    		"data":{"data":data,"dataID":ID,"prices":prices},
    		"dataType":"json",
    		"success":function(i){
    			if(i==1){
    				inti(centerforadvancedPersonnelName,pageNo);
    				
    			}
    		}
    	});
   		 
    } 
    
    function inti(centerforadvancedPersonnelName,pageNo){
    	$.ajax({
    		"url":"Advanced3.do",
    		"data":{"centerforadvancedPersonnelName":centerforadvancedPersonnelName,"pageNo":pageNo},
    		"dataType":"json",
    		"success":function(result){
    			$("tbody tr").remove();
    			$.each(result.page.list, function(index,centerforadvanced) {
    				/* var $data=this.centerforadvancedCarKey;
    		    	var $ID=this.centerforadvancedId; */
    				var $tr=$("<tr>"+
    					"<td>"+
    				  "<div class='layui-unselect layui-form-checkbox' lay-skin='primary' data-id='2'><i class='layui-icon'>&#xe605;</i></div>"
    				     +"</td>"+
    				     "<td class='taclass2'>"+ this.centerforadvancedId+"</td>"+
    					"<td>"+this.centerforadvancedPolicyHolderName+"</td>"+
    					"<td>"+this.centerforadvancedPersonnelName+"</td>"+
    					"<td>"+this.centerforadvancedDangerAddress+"</td>"+
    					"<td >"+this.centerforadvancedCarNo+"</td>"+
    					"<td>"+this.centerforadvancedAdvancePrices+"元</td>"+
    					"<td class='taclass1'>"+this.centerforadvancedCarKey+"</td>"+
    					"<td>"+timeFormat(this.centerforadvancedTime)+"</td>"+
    					"<td  class='td-status'>"+
    					"<span id='span1111' class='layui-btn layui-btn-normal layui-btn-mini' onclick=zhuangtai('"+this.centerforadvancedCarKey+"',"+this.centerforadvancedId+","+this.centerforadvancedAdvancePrices+");>"
    					+this.centerforadvancedExamineAndVerify+"</span>"+
    					"</td></tr>"
    				);
    				$("tbody").append($tr);
    			});    		
    		    	$("#pageNo").val(result.page.pageNo);
    		    	
    		    	
    				
    				/* 首页 */
    				$(".num1").attr("href","javascript:inti("+centerforadvancedPersonnelName+",1)")
    				/* 上一页 */
    				$(".num2").attr("href","javascript:inti("+centerforadvancedPersonnelName+","+(result.page.pageNo-1)+")")
    				/* 下一页 */
    				$(".num3").attr("href","javascript:inti("+centerforadvancedPersonnelName+","+(result.page.pageNo+1)+")")
    				/* 尾页 */
    				$(".num4").attr("href","javascript:inti("+centerforadvancedPersonnelName+","+result.page.pageTotal+")")
    				
    				/*获取所有的Span标签  */
    			var cao =document.getElementsByClassName("layui-btn-normal");
    				for (var i = 0; i < cao.length; i++) {
    					if(cao[i].innerHTML =="审核通过" ){
        		    		cao[i].style.backgroundColor ="#009688";
        		    		cao[i].style.width = "73.5%";
        		    	}else if(cao[i].innerHTML == "审核未通过" ){
        		    		cao[i].style.backgroundColor ="#F55C23";
        		    		cao[i].style.width = "73.5%";
        		    	}else if(cao[i].innerHTML == "复审中" ){
        		    		cao[i].style.backgroundColor ="#FFB800";
        		    		cao[i].style.width = "73.5%";
        		    	
        		    	}else if(cao[i].innerHTML == "申请中" ){
        		    		cao[i].style.backgroundColor ="#3AB2FF";
        		    		cao[i].style.width = "73.5%";
        		    	
        		    	}
					}
    				
    		    	
    		}
    	})
    }
    </script>
    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });

    </script>
   
  </body>

</html>